package com.tanhua.autoconfig.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import com.baidu.aip.face.AipFace;
import org.springframework.context.annotation.Bean;

/**
 * @Author Pan Rundong
 * @Date 2023-02-25 14:01
 * @Desc 百度人脸识别
 */
@Data
@ConfigurationProperties(prefix = "tanhua.api")
public class ApiFaceProperties {

    public String appId;
    public String apiKey;
    public String secretKey;

    @Bean
    public AipFace apiFace() {
        // 初始化一个AipFace
        AipFace client = new AipFace(appId, apiKey, secretKey);

        // 可选：设置网络连接参数
        client.setConnectionTimeoutInMillis(2000);
        client.setSocketTimeoutInMillis(60000);
        return client;
    }
}
